import permissionApi from "@/api/declaration/crm/permissionApi"
import httpRequest from "@/config/axios/httpRequest"
import { CrmPermissionModel } from "@/models/crm/CrmPermissionModel"



// 获得数据权限列表（查询团队成员列表）
export const getPermissionList = async (params) => {
  return await httpRequest.get(permissionApi.GetPermissionList, { params })
}

// 创建数据权限（新增团队成员）
export const createPermission = async (data: CrmPermissionModel) => {
  return await httpRequest.post(permissionApi.CreatePermission, data)
}

// 编辑数据权限（修改团队成员权限级别）
export const updatePermission = async (data) => {
  return await httpRequest.put(permissionApi.UpdatePermission, data)
}

// 删除数据权限（删除团队成员）
export const deletePermissionBatch = async (val: number[]) => {
  return await httpRequest.delete(permissionApi.DeletePermissionBatch, { params: { val } })
}

// 删除自己的数据权限（退出团队）
export const deleteSelfPermission = async (id: number) => {
  return await httpRequest.delete(permissionApi.DeleteSelfPermission, { params: { id } })
}
